﻿using NetWing.Common.Data.SqlServer;
using System;
using System.Data;

namespace NetWing.BPM.Admin.psi
{
    public partial class yujkc : System.Web.UI.Page
    {
        protected string sDateJson;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) 
            {
                DateTime dtnow = DateTime.Now;
                DataTable dttable = SqlEasy.ExecuteDataTable("select * from Psi_Goods");
                foreach (DataRow dr in dttable.Rows)
                {
                    DateTime dttime = Convert.ToDateTime(dr["up_time"].ToString());
                    if (dtnow.AddMonths(-4) > dttime)
                    {
                        sDateJson += "{\"KeyId\":" + dr["KeyId"].ToString() + ",\"goodsNo\":\"" + dr["goodsNo"].ToString() + "\",\"goodsName\":\"" + dr["goodsName"].ToString() + "\",\"goodsShortName\":\"" + dr["goodsShortName"].ToString() + "\",\"goodsClassName\":\"" + dr["goodsClassName"].ToString() + "\",\"specs\":\"" + dr["specs"].ToString() + "\",\"unit\":\"" + dr["unit"].ToString() + "\",\"stock\":\"" + dr["stock"].ToString() + "\",\"buyPrice\":\"" + dr["buyPrice"].ToString() + "\",\"up_time\":\"" + dr["up_time"].ToString() + "\"},";
                    }
                    //if (!string.IsNullOrEmpty(sDateJson))
                    //{
                    //    sDateJson = sDateJson.Substring(0, sDateJson.Length - 1);
                    //}
                }
            }
        }
     
    }
}